var winEmps = new Array();
var closeCallBackFns = new Array();
var returnVal = new Object();
var isCallBack = false;
function openWin(url,fn,winParam){
	winParam = winParam || {};
	var winEmp = new top.Ext.Window({
		title: '新增',
		resizable: true,
		layout:'fit',
		width:winParam.width?winParam.width:900,
		height:winParam.height?winParam.height:580,
		draggable:true,
        constrain:true,//将拖动范围限制在容器内
		modal:true,
		autoScroll:true,
		autoDestroy:true,
		maximizable:true,
		minimizable:true,
		collapsible:true,
		closable:true,
		closeAction:'hide',
//		listeners:{'hide':{fn:fn}},
		bodyStyle:'overflow-y:auto;overflow-x:hidden;',
		html:"<iframe src='" + url + "' frameborder=\"0\" width=\"100%\" height=\"100%\"></iframe>"
	});
//	if(fn){
//		winEmp.on('hide',fn);
//	}
	closeCallBackFns.push(fn);
    winEmp.show();
    winEmps.push(winEmp);
}

function setIsCallBack(callBack){
	isCallBack = callBack;
}

function setReturnValue(rtnObj){
	returnVal = rtnObj;
}

function getReturnValue(){
	return returnVal;
}

function closeWin(){
	if(winEmps && winEmps.length>0){
		var winEmp = winEmps[winEmps.length -1];
		winEmp.close();
		if(isCallBack){
			closeCallBackFns[closeCallBackFns.length-1].call();
			isCallBack = false;
		}
	}
}